Skip to content

refactor: parameterize mentor-duty label#2147

Merged
exploreriii merged 2 commits into
hiero-ledger:mainfrom
mitul001:refactor/mentor-duty-label
Apr 18, 2026
Merged

refactor: parameterize mentor-duty label#2147
exploreriii merged 2 commits into
hiero-ledger:mainfrom
mitul001:refactor/mentor-duty-label

Conversation

@mitul001

Copy link
Copy Markdown
Contributor

Fixes #2128

@mitul001
mitul001 requested review from a team as code owners April 15, 2026 15:45
@codacy-production

codacy-production Bot commented Apr 15, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mitul001 thanks for this but please check your submission it needs to be DCO+GPG key signed as per the issue description

@exploreriii
exploreriii marked this pull request as draft April 15, 2026 15:48
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Added a configurable MENTOR_LABEL (default notes: mentor-duty) and a runtime guard in the bot assignment check script; updated the gh api label filter and diagnostic text to use this variable. The workflow step now sets MENTOR_LABEL in the script environment.

Changes

Cohort / File(s) Summary
Assignment check script
.github/scripts/bot-assignment-check.sh
Introduce MENTOR_LABEL default (notes: mentor-duty) and fail early if empty; update gh api query to exclude issues matching the configured label via --arg mentor_label "$MENTOR_LABEL"; adjust diagnostic/log text to reference the configured label.
Workflow env export
.github/workflows/bot-assignment-check.yml
Export MENTOR_LABEL="notes: mentor-duty" in the Check Assignment Count step environment so the script receives the configured label at runtime.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: parameterize mentor-duty label' accurately and clearly summarizes the main change, which is to parameterize the mentor-duty label for easier future maintenance.
Description check ✅ Passed The description references the linked issue #2128, which is directly related to the changeset of parameterizing the mentor-duty label.
Linked Issues check ✅ Passed The PR successfully parameterizes the mentor-duty label by introducing a MENTOR_LABEL variable, sets it to 'notes: mentor-duty', and updates scripts to use this variable instead of hard-coded values, meeting all requirements from issue #2128.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #2128: parameterizing the mentor-duty label and updating references in scripts and workflows, with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #2128

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 995680c6-2154-4856-8706-99475ef7984e

📥 Commits

Reviewing files that changed from the base of the PR and between 43d6fd2 and 36aa126.

📒 Files selected for processing (1)
  • .github/scripts/bot-assignment-check.sh

Comment thread .github/scripts/bot-assignment-check.sh Outdated
Comment thread .github/scripts/bot-assignment-check.sh Outdated
@mitul001
mitul001 force-pushed the refactor/mentor-duty-label branch 3 times, most recently from 7c5a47d to 2627323 Compare April 16, 2026 06:06
@mitul001
mitul001 marked this pull request as ready for review April 16, 2026 06:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e137dbe4-9381-45f1-bb15-6869dd96b345

📥 Commits

Reviewing files that changed from the base of the PR and between 36aa126 and 2627323.

📒 Files selected for processing (2)
  • .github/scripts/bot-assignment-check.sh
  • .github/workflows/bot-assignment-check.yml

Comment thread .github/scripts/bot-assignment-check.sh
@mitul001
mitul001 force-pushed the refactor/mentor-duty-label branch from 2627323 to 1cc088e Compare April 16, 2026 06:13
@mitul001
mitul001 requested a review from exploreriii April 16, 2026 06:20
@mitul001
mitul001 force-pushed the refactor/mentor-duty-label branch from 09243c5 to c6b15bb Compare April 16, 2026 11:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
.github/scripts/bot-assignment-check.sh (1)

57-60: ⚠️ Potential issue | 🔴 Critical

gh api --jq --arg is invalid here and can silently undercount assignments.

Line 57 passes --arg as if it were a gh api flag. On failure, || echo 0 converts the error into a zero count, which can incorrectly allow extra triage assignments.

Proposed fix
-     gh api "repos/${REPO}/issues?per_page=100&page=1" \
-       -f assignee="${ASSIGNEE}" \
-       -f state=open \
-       --jq --arg mentor_label "$MENTOR_LABEL" '.[]
-            | select(.pull_request == null)
-            | select(any(.labels[]; .name == $mentor_label) | not)
-            | .number' | grep -c . || echo 0
+     gh api "repos/${REPO}/issues?per_page=100&page=1" \
+       -f assignee="${ASSIGNEE}" \
+       -f state=open \
+       | jq -r --arg mentor_label "$MENTOR_LABEL" '
+            [.[]
+             | select(.pull_request == null)
+             | select(any((.labels // [])[]; .name == $mentor_label) | not)
+            ] | length
+         '
#!/bin/bash
set -euo pipefail

echo "== gh api supported flags =="
gh api --help | rg -n -- '--jq|--arg' || true

echo
echo "== reproduce option parsing behavior =="
set +e
gh api repos/cli/cli/issues --jq --arg mentor_label test '.[].number' 2>&1 | sed -n '1,6p'
status=$?
set -e
echo "exit_status=${status}"

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f4858ebd-7b64-4c80-a5bf-4581da4f6808

📥 Commits

Reviewing files that changed from the base of the PR and between 2627323 and c6b15bb.

📒 Files selected for processing (2)
  • .github/scripts/bot-assignment-check.sh
  • .github/workflows/bot-assignment-check.yml

@mitul001
mitul001 force-pushed the refactor/mentor-duty-label branch 2 times, most recently from 9c83ce6 to 90c88e0 Compare April 16, 2026 12:10
exploreriii
exploreriii previously approved these changes Apr 16, 2026
@exploreriii exploreriii added step: 2nd second stage of the review approval process reviewer: write requires a review with write permissions labels Apr 16, 2026
manishdait
manishdait previously approved these changes Apr 16, 2026
@manishdait

Copy link
Copy Markdown
Contributor

Hi @mitul001, rebase or click the update branch button in ui

@github-actions github-actions Bot added skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues scope: CI/CD involves continuous integration or delivery labels Apr 16, 2026
@exploreriii exploreriii added step: merge ready PR is ready and waiting to merge and removed reviewer: write requires a review with write permissions step: 2nd second stage of the review approval process labels Apr 16, 2026
@exploreriii exploreriii added the status: update branch developer needs to click update branch label Apr 16, 2026
@mitul001
mitul001 force-pushed the refactor/mentor-duty-label branch from 90c88e0 to f6208af Compare April 17, 2026 04:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/scripts/bot-assignment-check.sh (1)

54-60: ⚠️ Potential issue | 🔴 Critical

gh api --jq still doesn't accept --arg; the triage count is silently zero.

Despite the previous review being marked as addressed, the current code still passes --arg mentor_label "$MENTOR_LABEL" directly as arguments to gh api --jq. The gh api --jq flag consumes only a single jq expression string and does not forward further flags to jq. At runtime this will fail with unknown flag: --arg (or treat --arg as the filter and fail to parse), and because the whole pipeline is guarded by || echo 0, the failure is masked and assignments_count silently returns 0 for every triage user — meaning mentors bypass the limit entirely.

Run through jq explicitly so --arg is honored:

🛠️ Proposed fix
-     gh api "repos/${REPO}/issues?per_page=100&page=1" \
-       -f assignee="${ASSIGNEE}" \
-       -f state=open \
-       --jq --arg mentor_label "$MENTOR_LABEL" '.[]
-            | select(.pull_request == null)
-            | select(any(.labels[]; .name == $mentor_label) | not)
-            | .number' | grep -c . || echo 0
+    gh api "repos/${REPO}/issues?per_page=100&page=1" \
+      -f assignee="${ASSIGNEE}" \
+      -f state=open \
+    | jq -r --arg mentor_label "$MENTOR_LABEL" '
+        .[]
+        | select(.pull_request == null)
+        | select(any((.labels // [])[]; .name == $mentor_label) | not)
+        | .number
+      ' | grep -c . || echo 0

Also worth decoupling the || echo 0 from grep -c (e.g., capture the pipeline status separately) so genuine API errors don't continue to be silently swallowed.

#!/bin/bash
# Confirm gh api --jq does not accept --arg
gh api --help 2>&1 | rg -nC2 -- '--jq|--arg' || true

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ee22a307-1041-426e-a29d-57cd4d6acd49

📥 Commits

Reviewing files that changed from the base of the PR and between c6b15bb and f6208af.

📒 Files selected for processing (2)
  • .github/scripts/bot-assignment-check.sh
  • .github/workflows/bot-assignment-check.yml

Comment thread .github/scripts/bot-assignment-check.sh
Signed-off-by: mitul001 <mitulp994@gmail.com>
@mitul001
mitul001 dismissed stale reviews from manishdait and exploreriii via ee07f7d April 17, 2026 05:01
@mitul001
mitul001 force-pushed the refactor/mentor-duty-label branch from f6208af to ee07f7d Compare April 17, 2026 05:01

@exploreriii exploreriii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mitul001 when you force push, you reset the review status, recommend to avoid that

@exploreriii exploreriii added the step: 2nd second stage of the review approval process label Apr 17, 2026
@mitul001

Copy link
Copy Markdown
Contributor Author

@mitul001 when you force push, you reset the review status, recommend to avoid that

Hi @exploreriii, thank you for the feedback and for approving the PR!

My apologies for the force-push. I was fixing the GPG signature and indentation issues, but I'll make sure to avoid resetting the review status with force-pushes in future submissions. Thanks for your patience!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/scripts/bot-assignment-check.sh (1)

54-60: ⚠️ Potential issue | 🔴 Critical

Fix gh api --arg; the triage count can silently become zero.

Line 57 still passes jq’s --arg flag to gh api, which does not support it. Because the pipeline ends with || echo 0, this can mask the CLI failure and allow over-assignment for triage users.

Proposed fix
-     gh api "repos/${REPO}/issues?per_page=100&page=1" \
-       -f assignee="${ASSIGNEE}" \
-       -f state=open \
-       --jq --arg mentor_label "$MENTOR_LABEL" '.[]
-            | select(.pull_request == null)
-            | select(any(.labels[]; .name == $mentor_label) | not)
-            | .number' | grep -c . || echo 0
+    gh api "repos/${REPO}/issues?per_page=100&page=1" \
+      -f assignee="${ASSIGNEE}" \
+      -f state=open \
+      | jq --arg mentor_label "$MENTOR_LABEL" '[
+          .[]
+          | select(.pull_request == null)
+          | select(any((.labels // [])[]; .name == $mentor_label) | not)
+        ] | length'

Verify the runner has the expected CLI behavior and jq available:

#!/bin/bash
set -euo pipefail

echo "== gh version =="
gh --version | sed -n '1p'

echo "== gh api jq-related flags =="
gh api --help | rg -n -- '--jq|--arg' || true

echo "== jq availability =="
command -v jq
jq --version

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3a697c3f-e101-4afd-a402-f1d54daa4cf0

📥 Commits

Reviewing files that changed from the base of the PR and between f6208af and b5eaab6.

📒 Files selected for processing (2)
  • .github/scripts/bot-assignment-check.sh
  • .github/workflows/bot-assignment-check.yml

Comment thread .github/scripts/bot-assignment-check.sh
@exploreriii
exploreriii merged commit a046740 into hiero-ledger:main Apr 18, 2026
11 checks passed
Abhijeet2409 pushed a commit to Abhijeet2409/hiero-sdk-python that referenced this pull request Apr 22, 2026
Signed-off-by: mitul001 <mitulp994@gmail.com>
Co-authored-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
AntonioCeppellini pushed a commit to AntonioCeppellini/hiero-sdk-python that referenced this pull request Apr 22, 2026
Signed-off-by: mitul001 <mitulp994@gmail.com>
Co-authored-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
parvninama pushed a commit to parvninama/hiero-sdk-python that referenced this pull request Apr 25, 2026
Signed-off-by: mitul001 <mitulp994@gmail.com>
Co-authored-by: exploreriii <133720349+exploreriii@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: CI/CD involves continuous integration or delivery skill: beginner Achievable by a fairly new comer that has already completed a couple of good first issues status: update branch developer needs to click update branch step: merge ready PR is ready and waiting to merge step: 2nd second stage of the review approval process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor 'mentor-duty' label use

3 participants